package cn.goktech.service;

import cn.goktech.pojo.User;
import cn.goktech.mapper.UserDao;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class UserDaoService {

    public UserDao userDao;

    public UserDaoService() {
    }
    @Autowired
    public UserDaoService(UserDao userDao) {
        System.out.println("正在执行有参构造初始化userDao的属性");
        this.userDao = userDao;
    }

    public void setUserDao(UserDao userDao) {
        //方法中的userDao参数其实本质上是UserDao的实现类对象，通过上转型对象来接收
        System.out.println("正在为UserDao进行实例化");
        this.userDao = userDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public List<User> selectAll(){
       return userDao.selectAll();
    }

}
